﻿using AutoMapper;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using WMS.FC.Domain.DomainObject.System;
using WMS.FC.Domain.Service.Cell.Interface;
using WMS.FC.Domain.Service.System;

namespace WMS.FC.Domain.Service.Cell
{
    public class GetCellBindBarcodeService : ServiceBase, IGetCellBindBarcodeService
    {
        public GetCellBindBarcodeService(ILogger<ServiceBase> logger, IOptions<WmsSettings> options, IMapper mapper) : base(logger, options, mapper)
        {
        }

        public async Task<ActionResult<string>> GetCellBindBarcode(string cellBarcode)
        {
            return await Task.Run(() =>
            {
                var result = new ActionResult<string>("获取电池绑定识别码");
                try
                {
                    result.Data = cellBarcode.Substring(3, 4);
                }
                catch (Exception ex)
                {
                    return result.Exception(ex);
                }

                return result;
            });
        }
    }
}
